package com.shwread.android.ui.dialog;

import android.app.Activity;
import android.content.ActivityNotFoundException;
import android.content.Context;
import android.content.Intent;
import android.view.View;
import android.widget.Button;


public class NoNetDialog
        extends
        CommonDialog
{
	
	private Activity activity;
	
	public NoNetDialog(Context context) {
		super(context);
		
		activity = (Activity) context;
		
		tvText.setText("网络未连接，请检查网络设置");
		((Button)vCancel).setText("取消");
	}
	
	@Override
	protected void clickOk(View v) {
		super.clickOk(v);
		startWirelessSettingsActivity(activity);
	}
	
	@Override
	protected void clickCancel(View v) {
	    this.dismiss();
	}
	
	
	public static void startWirelessSettingsActivity(Activity context) {
		try
		{
			Intent intent = new Intent(android.provider.Settings.ACTION_WIRELESS_SETTINGS);
			intent.setFlags(Intent.FLAG_ACTIVITY_NO_HISTORY);
			context.startActivity(intent);
		}
		catch (ActivityNotFoundException e)
		{
			
		}
	}
}
